import json
import uuid

from langchain_core.runnables import RunnableConfig

from video_summarize_tools.data_models import RuntimeContext, State
from video_summarize_tools.tools.modelscope_service import ModelScopeService
import video_summarize_tools.graph as graph
modelscope_service = ModelScopeService()

context = RuntimeContext(modelscope_service)
context.video_frame_extract_fps = 1
graph = graph.get_graph()


thread_id = str(uuid.uuid4())
config: RunnableConfig = {"configurable": {"thread_id" : thread_id}}
init_state: State = {"source_url": "https://www.youtube.com/shorts/hso4akZRkH0"}
result_state = graph.invoke(init_state, config = config, context = context)

print(result_state['video_summarize_text'])
print(result_state['audio_transcript_text'])
print(result_state['merge_result'])